import {useState,useEffect} from 'react'
import axios from 'axios'
import {API} from '../config'

export default function useGetCategoriers(){
  const [categories,setCategories] = useState([])
  useEffect( ()=>{
    async function getCategories(){
      let res = await axios.get(`${API}/categories`)
      setCategories(res.data)
    }
    getCategories()
  },[])
  return categories
}

